home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / Inventor / www / workarounds / TexturePop2.0.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  984 b   |  31 lines

  1. //
  2. // This is a patch for the Inventor 2.0 Texture code, which can
  3. // send bad display lists indices to OpenGL.  The results can be
  4. // anything from nothing (OpenGL interprets the command as an empty
  5. // display list), to random OpenGL calls being made (if the display
  6. // list index already exists), to a core dump.
  7. //
  8. //
  9. // To apply this patch, compile this file into a .o and then link
  10. // the .o before -lInventor.  The linker may give a warning.
  11. // This is normal and expected.
  12. //
  13.  
  14. #include <Inventor/elements/SoGLTextureImageElement.h>
  15.  
  16. void
  17. SoGLTextureImageElement::pop(SoState *state, const SoElement *)
  18. {
  19.     // Empty texture, don't need to do anything-- the
  20.     // GLTextureEnabledElement will turn off texturing.
  21.     if (size[0] == 0 || size[1] == 0 || numComponents == 0) {
  22.     return;
  23.     }
  24.     // Since popping this element has GL side effects, make sure any
  25.     // open caches capture it
  26.     capture(state);
  27.  
  28.     // Restore previous texture image (if any)
  29.     send(state);
  30. }
  31.